<template>
	<view class="p30">
		<view class="p30 bg-fff radius10">
			<view class="">请输入备注信息</view>
			<u-input type="textarea" v-model="form.remarks" :clearable="false" class="mt20" height="300" maxlength="500"
				placeholder="请输入备注信息">
			</u-input>
			<view class="flex row-right">
				<view class="">{{form.remarks.length}}/500</view>
			</view>
		</view>
		<view class="p30 bg-fff radius10 mt20">
			<view class="mb20">上传照片</view>
			<z-imgs up @success="form.images=$event" max="9" :ids="data.images" :paths="data.images_path"/>
		</view>
		<view class="pf bg-fff p30 w-max left0 bottom0">
			<u-button shape="circle" type="warning" ripple @click="submit">提交</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					remarks: '',
					images: '',
				},
				data: ''
			};
		},
		onLoad(e) {
			if (e.id) {
				this.getData()
				uni.setNavigationBarTitle({
					title: '编辑信息'
				})
			}
		},
		methods: {
			getData() {
				this.$request('/master/customer/logInfo', this.$params).then(res => {
					this.data = res.data
					for (let key in this.form) {
						this.form[key] = res.data[key] ?? this.form[key]
					}
				})
			},
			submit() {
				if (!this.form.remarks) return this.$msg('请输入内容')
				let api = '/master/customer/createLog'
				if (this.$params.id) api = '/master/customer/editLog'
				this.$request(api, {
					...this.$params,
					...this.form,
				}).then(res => {
					this.$msg(res.msg)
					this.$navBack(1, 1000)
				})
			},
		}
	}
</script>

<style lang="scss">

</style>